<div class="main">
	<div class="container" style="margin-bottom: 20px;">
		<div id="slideBox" class="slideBox2">
			<div class="hd">
				<ul>
					{volist name="banner" id="item"}
					<li></li>
					{/volist}
				</ul>
			</div>
			<div class="bd">
				<ul>
					{volist name="banner" id="item"}
					<li><a href="{$item.url}" target="_blank"><img src="{$item.image}" /></a></li>
					{/volist}
				</ul>
			</div>

			<!-- 下面是前/后按钮代码，如果不需要删除即可 -->
			<a class="prev" href="javascript:void(0)"></a>
			<a class="next" href="javascript:void(0)"></a>
		</div>
		<div style="display: flex;justify-content: space-between;">
			<div style="width: 880px; padding:40px 20px 20px;background: #fff;">
				<div style="display: flex; align-items: center; justify-content: center;">
					<div class="center_form" style="width: 500px;position: relative;">
						
								<div class="search_container" style="margin:0 0 15px;background: #fff;border:1px solid #e5e5e5; display: flex; align-items: flex-start; justify-content: space-between;">
									<input type="search" onkey class="search" style="background: #fff;"  placeholder="仅支持橡塑技术与装备行业专业词汇中英文翻译"  />
									<button class="layui-btn layui-btn-normal"><i class="iconfont">&#xe65c;</i></button>
								</div>
								<ul class="sousuotuijian">
								
								</ul>
								{if(!is_null($rs))}
								<div class="fanyi_result">
									<ul>
										<li><label>词汇：</label>{$rs.word}</li>
										<li><label>解释：</label>{$rs.explains}</li>
										<li><label>拼音：</label>{$rs.py}</li>
									</ul>
								</div>
								{else/}
									{$empty}
								
								{/if}	

						        
						
						
					</div>


				</div>
				<img src="/pc/img/img_zhuanyecidian.jpg" style="display: block;margin: auto; max-width: 100%;" />
			</div>
			<div style="width: 310px;">
				{volist name="hangyexinxi_type2" id="item"}
				<div class="arclist_303" style="margin-bottom: 10px;">
					<div class="list_title">{$item.name}</div>
					<ul class="news_list" style="height: auto;">
						{volist name="item['list']" id="detail_item"}
						<a href="{:url('hangyexinxi/detail',['id'=>$detail_item.id])}">
							<li>{$detail_item.title}</li>
						</a>
						{/volist}
					</ul>
				</div>
				{/volist}
			</div>
		</div>
	</div>
</div>
<script>
	jQuery(".slideBox2").slide({
		mainCell: ".bd ul",
		autoPlay: true
	});

	
		$("input.search").keypress(function (e) {
		    	// 兼容写法
		      e = e || window.event;
		      key = e.keyCode || e.which || e.charCode;
		      if (key == 13) {
		          console.log($(this).val());
				  if($(this).val().trim()==''){
					  alert('请输入关键词');
					  return false;
				  }
				  window.open('{:url('cihui/fanyi')}?keyword='+$(this).val(),'_blank')
		      }
		  });
		  $('input.search').bind('input propertychange', function(){
			  if($(this).val().trim()!=""){
				  $.ajax({
				      type:"GET",
				      url:"/api.php/index/get_cihui",
				      dataType:"json",
				      data:{
				          "keyword":$(this).val(),
				      },
				      success:function(res){
				        console.log(res.data);
				  					html='';
				  					for( var i in res.data){
				  						html+='<li onclick="gosearch(this)">'+res.data[i].word+'</li>';
				  					}
				        $('.sousuotuijian').html(html); 
				      }
				  });
			  }else{
				  $('.sousuotuijian').html(''); 
			  }
		      
		  })
		  
		  function gosearch(e){
			  var keyword=$(e).text();
			  window.open('{:url('zhuanyecidian/fanyi')}?keyword='+keyword,'_blank')
		  }

</script>